package game;

import java.awt.Dimension;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JDialog;

/**
 * User Interface for player.
 * 
 * @author Sarun Wongtanakarn 5510546166
 * @author Apiwat Jierakulpanit 5510546212
 * @Version 2013.05.01
 */
public class Canvas extends JDialog implements KeyListener {

	private GameController game;

	/**
	 * Creates the user interface with giving the game and size.
	 * @param game the GameController of this UI
	 * @param width the width of this UI
	 * @param height the height of this UI
	 */
	public Canvas(GameController game, int width, int height) {
		super();
		this.game = game;
		this.setPreferredSize(new Dimension(width, height));
		this.addKeyListener(this);
		this.setLocation(50, 100);
		this.pack();
		this.setVisible(true);

	}

	@Override
	public void keyTyped(KeyEvent e) {

	}

	@Override
	public void keyPressed(KeyEvent e) {
		game.getKey(e.getKeyCode());
	}

	@Override
	public void keyReleased(KeyEvent e) {

	}

}
